<template>
  <el-dialog v-if="dialogFormVisible" v-el-drag-dialog class="select-ztree-dialog" :visible.sync="dialogFormVisible" :close-on-click-modal="false" :width="winWidth+'px'" :title="dialogTitle" :append-to-body="true" @close="closeDialog">
    <div v-if="loading" v-loading="loading" class="el-dialog__body" style="height:366px" />
    <div v-if="!loading" class="select-dialog-container">
      <el-row v-if="showSearchInput">
        <el-col span="24" class="search-input-container">
          <el-input v-model="searchkey" size="small" placeholder="请输入搜索关键字" @keyup.enter.native="searchTreeNode">
            <el-select v-if="showSelectByTabs" slot="prepend" v-model="selectByTabsActiveName" placeholder="请选择" @change="onSelectByTabsHandleClick">
              <el-option label="按机构" value="byOrg" />
              <el-option label="按群组" value="byWorkgroup" />
              <el-option label="按岗位" value="byJobPosition" />
            </el-select>
            <el-button slot="append" icon="el-icon-search" @click="searchTreeNode" />
          </el-input>
        </el-col>
      </el-row>
      <el-row v-loading="searchDoading" class="searchdoing" :class="fontMagnify?'font-magnify':''">
        <el-col v-if="isStaffExt" :span="isStaffExt?8:12" class="ztree-container" style="margin-top:10px;overflow-y:inherit">
          <div class="treeNode">
            <div style="padding:6px;border-bottom:1px solid #dfe6ec">
              <el-select v-model="selectRootOrg" size="mini" style="width:100%" placeholder="请选择" @change="loadSubOrg">
                <el-option
                  v-for="(item,index) in rootOrgList"
                  :key="item.id"
                  :label="item.name"
                  :value="index"
                />
              </el-select>
            </div>
            <GiantTree v-if="rootTreeData!==null" :style="isStaffExt?{'height':'278px'}:''" :nodes="rootTreeData" :multiple="false" :show-icon="showIcon" :show-line="showLine" @onCreated="onTreeCreated" @onClick="rootOrgTreeNodeClick" />
          </div>
        </el-col>
        <el-col class="ztree-container" :span="isStaffExt?6:12" :class="{listitem:dialogName==='listitemDialog'}" style="margin-top:10px;">
          <div class="treeNode" style="margin-right:0;overflow-y:inherit;">
            <div v-if="binding.value === 'suborgExt'" style="padding:6px;border-bottom:1px solid #dfe6ec">
              <el-select v-model="selectRootOrg" size="mini" style="width:100%" placeholder="请选择" @change="loadSubOrg">
                <el-option
                  v-for="(item,index) in rootOrgList"
                  :key="item.id"
                  :label="item.name"
                  :value="index"
                />
              </el-select>
            </div>

            <div v-if="showSelectAllNodes" class="select-all-org">
              <el-checkbox v-model="selectAllNodes" :indeterminate="indeterminate" @change="selectAllNodesClick">全选</el-checkbox>
            </div>
            <GiantTree
              v-if="treeData!==null&&treeData.length!==0"
              :style="binding.value==='suborgExt'&&showSelectAllNodes?'height:calc(100% - 88px)':(binding.value==='suborgExt'?'height:calc(100% - 41px)':(showSelectAllNodes?'height:calc(100% - 37px)':''))"
              :setting="zTreeSetting"
              :nodes="treeData"
              :multiple="multiple"
              :show-icon="showIcon"
              :show-line="showLine"
              @onCreated="onTreeCreated"
              @onClick="onTreeNodeClick"
              @onCheck="onTreeNodeCheck"
            />
            <div v-if="treeData===null||treeData.length===0" style="text-align:center;font-size:14px;padding-top:20px">
              <span>{{ treeData===null?"正在加载...":"无数据" }}</span>
            </div>
          </div>
        </el-col>
        <el-col class="ztree-container" :span="isStaffExt?10:12" style="margin-top:10px;">
          <div class="treeNode" style="margin-right:0;margin-left:5px;padding:5px;overflow-y:auto;">
            <div v-for="(selectedNode,selectedNodeKey) in selectedNodes" :key="selectedNodeKey" class="selectnode" @click="removeSelectedNode(selectedNodeKey)">{{ selectedNode.staffFullName ||selectedNode.title }}<i class="el-icon-close" /></div>
          </div>
        </el-col>
      </el-row>
    </div>

    <div slot="footer" class="dialog-footer">
      <el-button plain icon="el-icon-close" @click="closeDialog">取 消</el-button>
      <el-button type="primary" icon="el-icon-check" @click="submitForm">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
    components: {

    },
    props: {
        winWidth: { type: Number, default: 600 }
    },
    data() {
        return {
            dialogTitle: '', // 弹窗辩题
            dialogName: null, // 弹窗Name
            dialogFormVisible: false,
            loading: false,
            el: null,
            binding: null,
            vnode: null,
            callback: null, // 回调函数
            treeData: null, // 树数据
            byOrgTreeData: null, // 工作流-按机构选择树数据
            byWgTreeData: null, // 工作流-按群组选择树数据
            byJbTreeData: null, // 工作流-按岗位选择树数据
            zTree: {}, // zTree原生对象
            zTreeSetting: {},
            showIcon: true, // 是否展示图标
            showLine: true, // 是否展示连接线
            multiple: false, // 是否多选
            prevSelected: [],
            searchkey: '', // 搜索
            selectedNodes: [], // 已选择数据
            selectedOrderBy: 'orgOrderNo', // 多选人员排序方式，默认按组织机构人员排序
            treeDataBak: '', // 搜索备份数据
            isStaffExt: false, // 是否人员选择扩展模式
            rootTreeData: null, // 人员选择扩展部门数据
            selectRootOrg: -1, // 被选择的公司
            rootOrgList: [], // 所有公司列表
            subOrgList: {}, // 已加载子机构
            folderUser: '/plugins/zTree/css/img/folder_user.png',
            user: '/plugins/zTree/css/img/user.png',
            searchDoading: false,
            indeterminate: false,
            showSelectAllNodes: false, // 是否显示全选复选框
            selectAllNodes: false, // 全选状态
            showSearchInput: true, // 是否显示搜索框
            fontMagnify: false, // 是否自定义标题字体
            openSysCode: '', // 仅显示开通指定系统的人员
            showSelectByTabs: false, // 是否显示按机构、按群组、按岗位选择人员切换标签，仅流程提交办理选择单位全体人员时有效
            selectByTabsActiveName: 'byOrg'
        }
    },
    computed: {
        ...mapGetters([
            'loginUser'
        ])
    },
    watch: {
    },
    created() {
        this.$bus.on('openSelectDialog', this.openSelectDialog)
    },
    beforeDestroy() {
        this.$bus.off('openSelectDialog', this.openSelectDialog)
    },
    mounted() {
    },
    methods: {
        async openSelectDialog(el, binding, vnode) {
            const _this = this
            if (_this.loading) {
                return
            }

            if (window.fontMagnify) this.fontMagnify = true
            this.loading = true
            this.dialogFormVisible = true
            this.isStaffExt = false
            this.el = el
            this.binding = binding
            this.vnode = vnode
            this.multiple = el.attrs.multiple

            this.selectedOrderBy = el.attrs['selected-order-by'] || this.selectedOrderBy

            let searchInput = null
            if (el.attrs['search-input'] === 'true')searchInput = true
            if (el.attrs['search-input'] === 'false') searchInput = false

            if (el.attrs['only-cur-sys'] !== 'false' && el.attrs['only-cur-sys'] !== false) {
                if (vnode.context.$parent.wfInstance) {
                    this.openSysCode = vnode.context.$parent.wfInstance.sysCode
                } else if (vnode.context.process && vnode.context.process.sysCode) {
                    this.openSysCode = vnode.context.process.sysCode
                } else if (vnode.context.vo && vnode.context.vo.sysCode) {
                    this.openSysCode = vnode.context.vo.sysCode
                } else if (this.loginUser.sysCode !== 'eccloud') {
                    this.openSysCode = this.loginUser.sysCode
                }
            }

            if (this.multiple === 'true') this.multiple = true
            if (this.multiple === 'false') this.multiple = false

            if (el.attrs['dialog-width'] && !isNaN(Number(el.attrs['dialog-width']))) this.winWidth = Number(el.attrs['dialog-width'])

            let reqParams = null
            if (!this.multiple || this.multiple === 'false' || el.attrs.onebyone === '1') {
                this.showSelectAllNodes = false
            } else if (binding.value === 'staff' || binding.value === 'wfNodeUser' || binding.value === 'staffExt' || binding.value === 'workgroupStaff' || binding.value === 'jobPositionStaff') {
                this.showSelectAllNodes = true
            } else {
                this.showSelectAllNodes = false
            }

            if (el.attrs['checkall-checkbox'] === 'true') this.showSelectAllNodes = true
            if (el.attrs['checkall-checkbox'] === 'false') this.showSelectAllNodes = false

            if (el.attrs.onebyone === '1' && this.multiple) {
                this.zTreeSetting = { check: { enable: true, chkStyle: 'radio', radioType: 'level' }}
            } else {
                this.zTreeSetting = { }
            }

            if (binding.value === 'staff' && el.attrs['org-level'] === '0') {
                binding.value = 'staffExt'
            }

            if (binding.value === 'treeNode') {
                this.dialogTitle = '选择机构目录'
                this.dialogName = 'treeDialog'

                reqParams = {
                    method: 'GET',
                    url: 'base/organMgr/findTreeNodeVOListByNodeId', // 加载目录树节点(TreeNode对象)url
                    params: { type: 'treeNode', status: 1 }// 查询条件
                }
                // 树节点级别
                if (el.attrs['node-level']) {
                    reqParams.params['nLevelFilter'] = Number(el.attrs['node-level'])
                }
                // 节点ID
                if (el.attrs['node-id']) {
                    reqParams.params['nodeId'] = el.attrs['node-id']
                    reqParams.params['self'] = true
                }
                this.callback = 'onSelectTreeNodeCompleted'
            } else if (binding.value === 'rootorg') {
                this.dialogTitle = '选择机构'
                this.dialogName = 'treeDialog'

                reqParams = {
                    method: 'GET',
                    url: 'base/organMgr/findTreeNodeVOListByNodeId', // 加载目录树节点(TreeNode、Oragnization两类对象)url
                    params: { status: 1 }// 查询条件
                }
                // 节点级别
                if (el.attrs['node-level']) {
                    reqParams.params['nLevelFilter'] = Number(el.attrs['node-level'])
                }
                // 节点ID
                if (el.attrs['node-id']) {
                    reqParams.params['nodeId'] = el.attrs['node-id']
                    reqParams.params['self'] = true
                }

                this.callback = 'onSelectRootorgCompleted'
            } else if (binding.value === 'suborg') {
                this.dialogTitle = '选择部门'
                this.dialogName = 'treeDialog'

                let orgCode = this.el.attrs['root-org-code']
                if (orgCode === undefined) {
                    orgCode = this.loginUser.orgCode
                }

                const params = { orgCode: orgCode }
                if (el.attrs['org-level'] !== undefined) {
                    const orgLevel = el.attrs['org-level'].split(',')
                    params.subOrgLevel = orgLevel[orgLevel.length - 1]
                }
                reqParams = {
                    method: 'GET',
                    url: 'base/organMgr/findAllOrganByOrgCode', // 加载部门/科室/班组树节点(Oragnization)url
                    params: params // 查询条件
                }

                this.callback = 'onSelectSuborgCompleted'
            } else if (binding.value === 'workgroup') {
                this.dialogTitle = '选择工作群组'
                this.dialogName = 'listitemDialog'

                let orgCode = this.el.attrs['root-org-code']
                if (orgCode === undefined) {
                    orgCode = this.loginUser.orgCode
                }

                reqParams = {
                    method: 'POST',
                    url: 'base/workGroup/querydata', // 加载工作群组列表(WorkGroup对象)url
                    data: [{ field: 'orgCode', compare: '=', value: orgCode }, { field: 'status', compare: '=', value: 1 }]// 查询条件
                }

                this.callback = 'onSelectWorkgroupCompleted'
            } else if (binding.value === 'jobPosition') {
                this.dialogTitle = '选择工作岗位'
                this.dialogName = 'listitemDialog'

                let orgCode = this.el.attrs['root-org-code']
                if (orgCode === undefined) {
                    orgCode = this.loginUser.orgCode
                }

                reqParams = {
                    method: 'POST',
                    url: 'base/jobPosition/querydata', // 加载工作岗位列表(JobPosition对象)url
                    data: [{ field: 'orgCode', compare: '=', value: orgCode }, { field: 'status', compare: '=', value: 1 }]// 查询条件
                }

                this.callback = 'onSelectJobPositionCompleted'
            } else if (binding.value === 'staff') {
                this.dialogTitle = '选择人员'
                this.dialogName = 'treeDialog'
                const treeData = this.el.attrs['init-tree-data']
                if (treeData === undefined) {
                    const orgId = this.el.attrs['org-id']
                    const orgLevel = this.el.attrs['org-level']
                    const subOrgName = this.el.attrs['sub-org-name']
                    const orgSelf = this.el.attrs['org-self']
                    let orgCode = this.el.attrs['root-org-code']

                    if (orgCode === undefined) {
                        orgCode = this.loginUser.orgCode
                    }

                    if (orgLevel === 1 || orgLevel === '1') {
                        reqParams = {
                            method: 'GET',
                            url: 'base/organMgr/findOrgLeaderByOrgCode', // 加载部门/科室/班组树节点(Oragnization)url
                            params: { orgCode: orgCode, self: orgSelf }// 查询条件
                        }
                    } else if (orgLevel === 2 || orgLevel === '2') {
                        this.orgId = ''
                        if (vnode.context.$parent.curTN) {
                            this.orgId = vnode.context.$parent.curTN.staffOrgID.split('-')[1]
                        } else {
                            this.loginUser.staffList.forEach(staff => {
                                this.orgId += (this.orgId === '' ? '' : ',') + staff.orgFullId.split('-')[1]
                            })
                        }
                        reqParams = {
                            method: 'GET',
                            url: 'base/organMgr/findOrganPersonByOrgId', // 加载部门/科室/班组树节点(Oragnization)url
                            params: { orgId: this.orgId, self: orgSelf }// 查询条件
                        }
                    } else if (orgId !== undefined && orgId !== null && orgId !== '') {
                        reqParams = {
                            method: 'GET',
                            url: 'base/organMgr/findOrganPersonByOrgId', // 加载部门/科室/班组树节点(Oragnization)url
                            params: { orgId: orgId, self: orgSelf }// 查询条件
                        }
                    } else if (subOrgName !== undefined && subOrgName !== null && subOrgName !== '') {
                        reqParams = {
                            method: 'GET',
                            url: 'base/organMgr/findOrganPersonBySubOrgName', // 加载部门/科室/班组树节点(Oragnization)url
                            params: { orgCode: orgCode, subOrgName: subOrgName, self: orgSelf }// 查询条件
                        }
                    } else {
                        reqParams = {
                            method: 'GET',
                            url: 'base/organMgr/findOrganPersonByOrgCode', // 加载部门/科室/班组树节点(Oragnization)url
                            params: { orgCode: orgCode, self: orgSelf }// 查询条件
                        }
                    }
                    reqParams.params.openSysCode = this.openSysCode
                }

                this.callback = 'onSelectStaffCompleted'
            } else if (binding.value === 'jobPositionStaff') {
                this.dialogTitle = '选择人员'
                this.dialogName = 'treeDialog'

                let orgCode = this.el.attrs['root-org-code']
                if (orgCode === undefined) {
                    orgCode = this.loginUser.orgCode
                }

                reqParams = {
                    method: 'GET',
                    url: 'base/organMgr/findOrganPersonByJobPosition', // 加载工作岗位人员url
                    params: { orgCode: orgCode, jobPositionCode: this.el.attrs['job-position-code'] }// 查询条件
                }

                this.callback = 'onSelectStaffCompleted'
            } else if (binding.value === 'workgroupStaff') {
                this.dialogTitle = '选择人员'
                this.dialogName = 'treeDialog'

                let orgCode = this.el.attrs['root-org-code']
                if (orgCode === undefined) {
                    orgCode = this.loginUser.orgCode
                }

                reqParams = {
                    method: 'GET',
                    url: 'base/organMgr/findOrganPersonByWorkgroup', // 加载工作群组成员url
                    params: { orgCode: orgCode, workgroupCode: this.el.attrs['workgroup-code'] }// 查询条件
                }

                this.callback = 'onSelectStaffCompleted'
            } else if (binding.value === 'wfNodeUser') {
                this.dialogTitle = '选择人员'
                this.dialogName = 'treeDialog'
                this.showSelectByTabs = this.el.attrs['show-select-by-tabs']
                this.selectByTabsActiveName = 'byOrg'

                let asyncOrgId = ''
                const wfNodeUsers = this.el.attrs['init-tree-data']
                wfNodeUsers.forEach(wfUser => {
                    if (wfUser.type === 'asyncLoadingUsers') {
                        asyncOrgId += (asyncOrgId === '' ? '' : ',') + (wfUser.orgId || wfUser.parentId)
                    }
                })
                if (asyncOrgId !== '') {
                    if (asyncOrgId === 'group') { // 全集团
                        let orgCode = this.el.attrs['root-org-code']
                        if (orgCode === undefined) {
                            orgCode = this.loginUser.orgCode
                        }

                        reqParams = {
                            method: 'GET',
                            url: 'base/organMgr/findOrganPersonForGroupOrg', // 加载部门/科室/班组树节点(Oragnization)url
                            params: { orgCode: orgCode }// 查询条件
                        }
                    } else { // 指定机构ID
                        reqParams = {
                            method: 'GET',
                            url: 'base/organMgr/findOrganPersonByOrgId', // 加载部门/科室/班组树节点(Oragnization)url
                            params: { orgId: asyncOrgId, self: asyncOrgId.split(',').length > 1 }// 查询条件
                        }
                    }

                    reqParams.params.openSysCode = this.openSysCode
                }

                this.callback = 'onSelectWfNodeUserCompleted'
            } else if (binding.value === 'staffExt') {
                this.winWidth = 800
                this.dialogTitle = '选择人员(扩展)'
                this.dialogName = 'treeDialog'
                this.isStaffExt = true

                let orgCode = this.el.attrs['root-org-code']
                if (orgCode === undefined) {
                    orgCode = this.loginUser.orgCode
                }
                const oldValue = this.vnode.data.attrs['old-value'] || ''
                reqParams = {
                    url: 'base/organMgr/findGroupOrganByOrgCode',
                    method: 'POST',
                    contentType: 'application/x-www-form-urlencoded',
                    params: { orgCode: orgCode },
                    data: oldValue.split(',')
                }

                this.callback = 'onSelectStaffCompleted'
            } else if (binding.value === 'suborgExt') {
                this.dialogTitle = '选择部门(扩展)'
                this.dialogName = 'treeDialog'

                let orgCode = this.el.attrs['root-org-code']
                if (orgCode === undefined) {
                    orgCode = this.loginUser.orgCode
                }

                reqParams = {
                    url: 'base/organMgr/findAllOrganByOrgCode',
                    method: 'GET',
                    contentType: 'application/x-www-form-urlencoded',
                    params: { orgCode: orgCode, subOrgLevel: 1 }
                }

                this.callback = 'onSelectSuborgCompleted'
            } else {
                this.dialogName = el.attrs['dialog-class'] || 'treeDialog'
                this.callback = 'on' + binding.value[0].toUpperCase() + binding.value.substring(1) + 'Completed'
            }

            if (el.attrs['dialog-title'] !== undefined) {
                this.dialogTitle = el.attrs['dialog-title']
            }

            if (reqParams !== null) {
                this.$http(reqParams).then(res => {
                    if (res.code === 'success') {
                        if (binding.value === 'suborgExt' || binding.value === 'staffExt') {
                            this.rootOrgList = res.body.listdata.filter(org => {
                                if (org.orgLevel === 1) return true
                            })

                            if (res.body.selectedNodes) {
                                res.body.selectedNodes.forEach(node => {
                                    node.checked = true
                                })

                                this.treeDataAdapter(res.body.selectedNodes)
                            }

                            this.selectRootOrg = 0
                            this.loadSubOrg()
                        } else if (binding.value === 'rootorg') {
                            const nodeIds = []
                            res.body.listdata.forEach(node => {
                                if (node.type === 'rootOrg') {
                                    node.fullID.split('-').forEach(id => {
                                        if (nodeIds.indexOf(id) === -1) {
                                            nodeIds.push(id)
                                        }
                                    })
                                }
                            })

                            const listdata = res.body.listdata.filter(node => {
                                if (node.type !== 'treeNode' || nodeIds.indexOf(node.id) !== -1) {
                                    return true
                                }
                            })

                            this.treeData = this.treeDataAdapter(listdata)
                            this.showSearchInput = searchInput !== null ? searchInput : this.treeData.filter(node => !node.personId).length > 1
                        } else {
                            this.treeData = this.treeDataAdapter(res.body.listdata)
                            this.showSearchInput = searchInput !== null ? searchInput : this.treeData.filter(node => !node.personId).length > 1
                        }
                    } else {
                        this.$alert(res.message, { type: 'error' })
                    }

                    _this.$nextTick(() => {
                        _this.loading = false
                    })
                })
            } else {
                _this.treeData = this.treeDataAdapter(_this.el.attrs['init-tree-data'])
                this.showSearchInput = searchInput !== null ? searchInput : this.treeData.filter(node => !node.personId).length > 1
                _this.$nextTick(() => {
                    _this.loading = false
                })
            }
        },
        treeDataAdapter(allTreeData) {
            const attr = this.el.attrs
            let treeData = JSON.parse(JSON.stringify(allTreeData))

            if (this.vnode.context.onSelectTreeDataLoaded) {
                treeData = this.vnode.context.onSelectTreeDataLoaded(treeData, attr)
            } else if (this.vnode.context.$vnode.context.onSelectTreeDataLoaded) {
                treeData = this.vnode.context.$vnode.context.onSelectTreeDataLoaded(treeData, attr)
            } else if (this.$vnode.context.$vnode.context.$vnode.context.onSelectTreeDataLoaded) {
                treeData = this.vnode.context.$vnode.context.$vnode.context.onSelectTreeDataLoaded(treeData, attr)
            }

            this.showIcon = true
            this.showLine = true
            // 当前值
            this.prevSelected = this.getPrevSelected()

            const pNodeLength = treeData.filter(tList => tList.nLevel === 1).length
            for (let i = 0; i < treeData.length; i++) {
                const node = treeData[i]
                node.checked = false
                if (node.type) node.type = node.type.replace(/\s*/g, '')

                if (this.binding.value === 'treeNode' || this.binding.value === 'rootorg') {
                    // 选择机构目录、主机构
                    node.pId = node.parentID
                    node.name = node.nName
                    node.title = node.name

                    // 第一级打开
                    if (!node.pId || node.pId === -1) {
                        node.open = pNodeLength === 1
                    }

                    if (node.type === 'rootOrg') {
                        node.isParent = false
                        node.icon = this.folderUser
                        node.title = node.name + ' ' + node.ocode

                        node.canSelect = true
                    } else if (this.binding.value === 'treeNode') {
                        node.canSelect = true
                    }
                    // else {
                    //     node.nocheck = true
                    // }
                } else if (this.binding.value === 'suborg' || this.binding.value === 'suborgExt') {
                    // 选择部门/科室/班组
                    let levels = attr['org-level']
                    if (levels === undefined) {
                        attr['org-level'] = '2'
                        levels = '2'
                    } else {
                        levels = levels.split(',')
                    }

                    node.pId = node.parentId || node.parentID
                    node.title = node.orgFullName || node.fullName
                    node.name = node.name || node.nName
                    node.title = node.title.replace(/[&\|\\\*^%$#@\-]/g, '-')
                    if (node.title.indexOf('-') !== -1) {
                        node.title = node.title.substring(node.title.indexOf('-') + 1)
                    }

                    if (node.orgLevel === 1 || node.olevel === 1) {
                        // 第一级打开
                        node.open = true
                    } else if (attr['org-level'].indexOf(node.orgLevel) !== -1 || attr['org-level'].indexOf(node.olevel) !== -1) {
                        // 允许选择
                        if (node.isRealOrg !== 0) node.canSelect = true
                    } else if (node.orgLevel > levels[levels.length - 1] || node.olevel > levels[levels.length - 1]) {
                        // 小于指定的机构级别，删除
                        treeData.splice(i--, 1)
                    }
                } else if (this.binding.value === 'staff' || this.binding.value === 'workgroupStaff' || this.binding.value === 'jobPositionStaff' || this.binding.value === 'wfNodeUser') {
                    // 选择机构员工
                    if (!node.personId) {
                        node.pId = node.parentID || node.parentId
                        node.name = node.nName || node.name
                        // node.icon = "components/zTree/css/img/folder_user.png";
                        node.title = node.fullName || node.orgFullName
                        node.title = node.title.replace(/[&\|\\\*^%$#@\-]/g, '-')

                        if (node.title.indexOf('-') !== -1) {
                            node.title = node.title.substring(node.title.indexOf('-') + 1)
                        }

                        if (i === 0 && attr['org-self'] === 'true') {
                            // 第一级打开
                            node.open = true
                        }

                        if (node.collapse === true) {
                            node.canSelect = true

                            if (attr.onebyone === '1' && this.multiple) {
                                this.zTreeSetting = { }
                            }
                        } else {
                            if (attr.onebyone === '1') {
                                node.nocheck = true
                            }
                            node.canSelect = false
                        }
                    } else if (node.collapse === true) {
                        for (let j = 0; j < treeData.length; j++) {
                            if (treeData[j].id === node.groupId || treeData[j].id === node.parentId || treeData[j].id === node.orgId) {
                                const collapseNodes = treeData[j].collapseNodes || []
                                if (attr.onebyone !== '1' || collapseNodes.length === 0) {
                                    collapseNodes.push(node)
                                    treeData[j].collapseNodes = collapseNodes

                                    treeData.splice(i--, 1)
                                }
                                break
                            }
                        }
                    } else {
                        let pname = node.fullName || node.orgFullName
                        pname = pname.replace(/[&\|\\\*^%$#@\-]/g, '-')
                        pname = pname.substring(node.orgFullName.indexOf('-') + 1)

                        node.pId = node.parentId || node.groupId || node.orgId
                        node.icon = this.user
                        node.title = pname + '\\' + node.name
                        if (attr.showmobile === true || attr.showmobile === 'true') {
                            if (node.mobile == null) node.mobile = '无'
                            node.name = node.name + '<' + (node.mobile === null ? '无' : node.mobile) + '>'
                            node.title = node.name
                        }
                        if (attr.showemail === true || attr.showemail === 'true') {
                            if (node.email === null) node.email = '无'
                            node.name = node.name + '<' + node.email + '>'
                            node.title = node.name
                        }
                        if (attr.showaccount === true || attr.showaccount === 'true') {
                            if (node.account === null) node.account = '无'
                            node.name = node.name + '<' + node.account + '>'
                            node.title = node.name
                        }
                        // console.log(node.title)
                        if (attr.onebyone === '1') {
                            node.radiobox = true
                        } else {
                            node.radiobox = false
                        }

                        // 允许选择
                        node.canSelect = true
                    }
                } else if (this.binding.value === 'staffExt') {
                    node.pId = node.parentID || node.orgId
                    node.title = node.fullName || node.orgFullName
                    node.name = node.nName || node.name
                    node.title = node.title.replace(/[&\|\\\*^%$#@\-]/g, '-')
                    if (node.title.indexOf('-') !== -1) {
                        node.title = node.title.substring(node.title.indexOf('-') + 1)
                    }
                    if (node.personId) {
                        node.canSelect = true
                        node.title = node.title.replace(/-/g, '\\') + '\\' + node.name
                        node.icon = this.user
                        node.staffFullName = node.orgFullName.replace(/-/g, '\\') + '\\' + node.name
                    }
                    if (node.olevel === 1) {
                        // 第一级打开
                        node.open = true
                    } else if (attr['org-level']) {
                        if (!attr['org-level'].indexOf(node.orgLevel) === -1 && !attr['org-level'].indexOf(node.olevel) === -1) {
                            // 小于指定的机构级别，删除
                            treeData.splice(i--, 1)
                        }
                    } else if (node.olevel > 3) {
                        // 小于指定的机构级别，删除
                        treeData.splice(i--, 1)
                    }
                } else {
                    // 选择(工作岗位、组织机构)列表
                    node.title = node.title || node.name
                    node.canSelect = (node.canSelect === true || node.canSelect === false) ? node.canSelect : true
                    node.icon = node.icon || ''
                    node.pId = node.pId || node.parentId || ''
                    this.showIcon = (node.showIcon === true || node.showIcon === false) ? node.showIcon : false
                    this.showLine = (node.showLine === true || node.showLine === false) ? node.showLine : false
                }

                // 默认选中项，优先取$scope.passenger，不存在则取value值
                if (node.canSelect) {
                    const vo = this.vnode.data.model.expression.split('.')[0]
                    const passenger = this.vnode.context[vo] ? this.vnode.context[vo].passenger : null
                    if (passenger && passenger[attr.name]) {
                        if (passenger[attr.name] instanceof Array) {
                            for (let pIndex = 0; pIndex < passenger[attr.name].length; pIndex++) {
                                if (passenger[attr.name][pIndex].id === node.id) {
                                    node.checked = true
                                    break
                                }
                            }
                        } else if (passenger[attr.name].indexOf(node.id) !== -1) {
                            node.checked = true
                        }
                    } else if (this.prevSelected.length > 0 && this.prevSelected[0] !== '') {
                        for (let j = 0; j < this.prevSelected.length; j++) {
                            const selected = this.prevSelected[j]
                            let title = node.title
                            if (selected.indexOf('\\') === -1 && title.indexOf('\\') > 0) {
                                title = title.substring(title.lastIndexOf('\\') + 1)
                            }

                            const account = node.name + '/' + node.account
                            if (selected === node.id || (selected === node.name && this.binding.value !== 'suborg' && this.binding.value !== 'suborgExt') || selected === title || selected === account || (node.code && selected === node.code)) {
                                node.checked = true
                                node.selectedIndex = j
                                this.prevSelected[j] = 'removed'
                                // this.prevSelected.splice(j--, 1)
                                break
                            }
                        }
                    }

                    if (node.checked) {
                        this.addToselectedNodes(node)
                    }
                }
            }

            if (this.binding.value === 'wfNodeUser' && this.showSelectByTabs === true) {
                if (this.selectByTabsActiveName === 'byOrg') {
                    this.byOrgTreeData = treeData
                } else if (this.selectByTabsActiveName === 'byWorkgroup') {
                    this.byWgTreeData = treeData
                } else if (this.selectByTabsActiveName === 'byJobPosition') {
                    this.byJbTreeData = treeData
                }
            }

            // treeData格式必须遵循ztreeview treeNode规范
            return treeData
        },
        // staffExt、suborgExt对话框加载子机构
        loadSubOrg() {
            this.treeData = null
            const rootOrg = this.rootOrgList[this.selectRootOrg]

            if (this.subOrgList[rootOrg.id] === undefined) {
                const reqParams = { method: 'GET', url: 'base/organMgr/findTreeNodeVOListByOrgId', params: { orgId: rootOrg.id, self: false, status: 1 }}

                this.$http(reqParams).then(res => {
                    if (res.code === 'success') {
                        if (!this.isStaffExt && this.multiple) {
                            let treeNode = [rootOrg]
                            treeNode = treeNode.concat(res.body.listdata)
                            res.body.listdata = treeNode
                        }
                        this.subOrgList[rootOrg.id] = this.treeDataAdapter(res.body.listdata)

                        if (this.isStaffExt) {
                            this.rootTreeData = this.subOrgList[rootOrg.id]
                            for (let i = 0; i < this.rootTreeData.length; i++) {
                                if (this.rootTreeData[i].olevel === 2) {
                                    this.rootOrgTreeNodeClick(null, null, this.rootTreeData[i])
                                    break
                                }
                            }
                            if (this.rootTreeData.length === 0) {
                                this.treeData = []
                            }
                        } else {
                            this.treeData = this.subOrgList[rootOrg.id]
                        }
                    } else {
                        this.$alert(res.message, { type: 'error' })
                    }
                })
            } else {
                if (this.isStaffExt) {
                    this.rootTreeData = this.subOrgList[rootOrg.id]
                    for (let i = 0; i < this.rootTreeData.length; i++) {
                        if (this.rootTreeData[i].olevel === 2) {
                            this.rootOrgTreeNodeClick(null, null, this.rootTreeData[i])
                            break
                        }
                    }
                    if (this.rootTreeData.length === 0) {
                        this.treeData = []
                    }
                } else {
                    this.treeData = this.subOrgList[rootOrg.id]
                }
            }

            this.searchkey = ''
        },
        getPrevSelected() {
            let pSelected = ''
            if (this.vnode.data.attrs['old-value']) {
                pSelected = this.vnode.data.attrs['old-value']
            } else if (this.el.value !== undefined && this.el.value !== null && this.el.value !== '') {
                pSelected = this.el.value
            } else if (this.vnode.data.model.value !== undefined && this.vnode.data.model.value !== null && this.vnode.data.model.value !== '') {
                pSelected = this.vnode.data.model.value
            } else {
                const model = this.vnode.data.model.expression.split('.')
                if (this.vnode.context[model[0]]) {
                    if (model.length === 2) {
                        pSelected = this.vnode.context[model[0]][model[1]] || ''
                    } else if (model.length === 3) {
                        pSelected = this.vnode.context[model[0]][model[1]][model[1]] || ''
                    } else {
                        pSelected = this.vnode.context[model[0]] || ''
                    }
                }
            }

            if (this.showSelectByTabs && this.selectedNodes.length > 0) {
                this.selectedNodes.forEach(item => {
                    if (pSelected !== '') pSelected += ','
                    pSelected += item.id
                })
            }

            if (this.el.attrs['separate']) {
                return pSelected.split(this.el.attrs['separate'])
            } else {
                return pSelected.replace(/、/g, ',').replace(/;/g, ',').replace(/，/g, ',').split(',')
            }
        },
        onTreeCreated(zTree) {
            if (this.binding.value === 'suborg') {
                zTree.setting.check.chkboxType = { Y: 's', N: 's' }
            }
            this.zTree = zTree

            if (this.selectedNodes.length === 0) {
                const selectedNodes = zTree.getCheckedNodes()
                this.selectedNodes = selectedNodes
            } else if (this.selectedOrderBy === 'selectedIndex') {
                this.selectedNodes.sort((a, b) => {
                    return a.selectedIndex - b.selectedIndex
                })
            }

            // 获取所有的父节点，只有一个父节点是展开节点
            const parentNodes = zTree.getNodesByFilter(tree => tree.level === 0)
            if (parentNodes.length === 1) {
                zTree.expandNode(parentNodes[0], true, false)// 指定选中ID节点展开
            }
            // const treeNodeArray = zTree.getNodes()
            // const parentNode = treeNodeArray.filter(node => node.isParent)
            // if (parentNode.length !== 0 && parentNode.length < 2) this.showSelectAllNodes = false
            this.judgeSeletAllType()
        },
        // 节点点击事件
        onTreeNodeClick(evt, treeId, treeNode) {
            if (treeNode.canSelect === true) {
                if (this.multiple !== true) {
                    this.selectedNodes = [treeNode]
                } else {
                    this.zTree.checkNode(treeNode, null, null, true)
                }
            } else if (treeNode.children && treeNode.children.length > 0) {
                this.zTree.expandNode(treeNode)
            }
        },
        // 选择人员扩展左侧部门点击事件
        rootOrgTreeNodeClick(evt, treeId, treeNode) {
            this.$http({
                url: 'base/organMgr/findLinkManByOrgId', // 加载指定机构下人员信息
                method: 'GET',
                contentType: 'application/x-www-form-urlencoded',
                params: { orgId: treeNode.id, self: true, openSysCode: this.openSysCode }
            }).then(res => {
                if (res.code === 'success') {
                    if (res.body.listdata.length > 0) {
                        const pnode = JSON.parse(JSON.stringify(treeNode))
                        pnode.open = true
                        delete pnode.children
                        const treeNodes = [pnode].concat(res.body.listdata)
                        this.treeData = this.treeDataAdapter(treeNodes)
                    } else {
                        this.treeData = []
                    }
                } else {
                    this.$alert(res.message, { type: 'error' })
                }
            })
        },
        // 全选事件
        selectAllNodesClick(val) {
            this.indeterminate = false
            this.zTree.checkAllNodes(val)
            if (this.selectByTabsActiveName === 'byWorkgroup' || this.selectByTabsActiveName === 'byJobPosition') {
                const allNodes = this.zTree.getCheckedNodes()
                if (allNodes.length > 0) {
                    allNodes.forEach(item => {
                        if (item.canSelect) {
                            this.addToselectedNodes(item)
                        }
                    })
                } else {
                    const allUsers = JSON.stringify(this.treeData)
                    for (let i = 0; i < this.selectedNodes.length; i++) {
                        if (allUsers.indexOf(this.selectedNodes[i].id) !== -1) {
                            this.selectedNodes.splice(i--, 1)
                        }
                    }
                }
            } else {
                this.selectedNodes = this.zTree.getCheckedNodes()
                for (let i = 0; i < this.selectedNodes.length; i++) {
                    if (!this.selectedNodes[i].canSelect) {
                        this.selectedNodes.splice(i--, 1)
                    }
                }
            }
        },
        // 判断当前全选状态
        judgeSeletAllType() {
            const checkedNodes = this.zTree.getCheckedNodes()
            this.selectAllNodes = checkedNodes.length === ((this.treeData !== null && this.treeData.length) || 0)
            if (checkedNodes.length === 0) {
                this.indeterminate = false
            } else if (checkedNodes.length < ((this.treeData !== null && this.treeData.length) || 0)) {
                this.indeterminate = true
            } else if (checkedNodes.length === ((this.treeData !== null && this.treeData.length) || 0)) {
                this.indeterminate = false
            }
        },
        onTreeNodeCheck(evt, treeId, treeNode) {
            if (this.binding.value === 'staffExt') {
                if (treeNode.checked) {
                    if (treeNode.personId) {
                        treeNode.orgCode = this.rootOrgList[this.selectRootOrg].code
                        this.addToselectedNodes(treeNode)
                    } else {
                        if (treeNode.children && treeNode.children.length > 0) {
                            treeNode.children.forEach(node => {
                                if (node.personId) {
                                    this.addToselectedNodes(node)
                                }
                            })
                        }
                    }
                } else {
                    const fullid = treeNode.orgFullId || treeNode.fullID || ''
                    for (let i = 0; i < this.selectedNodes.length; i++) {
                        if (this.selectedNodes[i].id === treeNode.id || (!treeNode.personId && fullid.indexOf(this.selectedNodes[i].orgId) !== -1)) {
                            this.selectedNodes.splice(i--, 1)
                        }
                    }
                }
            } else if (this.binding.value === 'suborgExt') {
                if (treeNode.checked) {
                    const olevel = treeNode.nLevel || treeNode.level
                    if (this.el.attrs['org-level'].indexOf(olevel) !== -1) {
                        this.addToselectedNodes(treeNode)
                    }

                    if (treeNode.children && treeNode.children.length > 0) {
                        treeNode.children.forEach(node => {
                            this.addToselectedNodes(node)
                        })
                    }
                } else {
                    for (let i = 0; i < this.selectedNodes.length; i++) {
                        const fullid = this.selectedNodes[i].orgFullId || this.selectedNodes[i].fullID
                        if (this.selectedNodes[i].id === treeNode.id || fullid.indexOf(treeNode.id) !== -1) {
                            this.selectedNodes.splice(i--, 1)
                        }
                    }
                }
            } else {
                if ((!this.searchkey || this.searchkey === '')) { // 如果不是搜索结果选择、取消
                    if (this.selectedOrderBy === 'selectedIndex' || this.showSelectByTabs === true) {
                        // 串行环节
                        if (treeNode.checked) {
                            if (treeNode.personId) {
                                this.addToselectedNodes(treeNode)
                            } else {
                                this.zTree.getCheckedNodes().forEach(node => {
                                    if (node.checked && node.personId && node.orgFullId && node.orgFullId.indexOf(treeNode.id)) {
                                        this.addToselectedNodes(node)
                                    }
                                })
                            }
                        } else {
                            for (let i = 0; i < this.selectedNodes.length; i++) {
                                if (this.selectedNodes[i].id === treeNode.id || (this.selectedNodes[i].orgFullId && this.selectedNodes[i].orgFullId.indexOf(treeNode.id) !== -1)) {
                                    this.selectedNodes.splice(i--, 1)
                                }
                            }
                        }
                    } else {
                        this.selectedNodes = this.zTree.getCheckedNodes()
                    }
                    for (let i = 0; i < this.selectedNodes.length; i++) {
                        if (!this.selectedNodes[i].canSelect) {
                            this.selectedNodes.splice(i--, 1)
                        }
                    }
                    this.judgeSeletAllType()
                } else { // 如果是搜索结果选择、取消
                    if (treeNode.checked) {
                        this.selectedNodes.push(treeNode)
                    } else {
                        for (let i = 0; i < this.selectedNodes.length; i++) {
                            if (this.selectedNodes[i].id === treeNode.id) {
                                this.selectedNodes.splice(i--, 1)
                            }
                        }
                    }
                }
            }
        },
        removeSelectedNode(i) {
            const node = this.zTree.getNodeByParam('id', this.selectedNodes[i].id, null)
            if (node != null) {
                this.zTree.checkNode(node, false, true, false)
            }

            this.selectedNodes.splice(i, 1)
            this.judgeSeletAllType()
        },
        addToselectedNodes(selectedNode) {
            const selected = this.selectedNodes.filter(node => {
                if (node.id === selectedNode.id) return true
            })
            if (selected.length === 0) this.selectedNodes.push(selectedNode)
        },
        searchTreeNode() {
            const searchkey = this.searchkey
            this.searchDoading = true
            if (searchkey === '') {
                if (this.treeDataBak !== '') {
                    const treeDataBak = JSON.parse(JSON.stringify(this.treeDataBak))
                    treeDataBak.forEach(node => {
                        const select = this.selectedNodes.filter(node2 => node2.id === node.id)
                        if (select.length > 0) {
                            node.checked = true
                        } else {
                            node.checked = false
                        }
                    })
                    this.treeData = treeDataBak
                    this.treeDataBak = ''
                }
                this.searchDoading = false
            } else {
                setTimeout(() => {
                    if (this.treeDataBak === '') {
                        this.treeDataBak = JSON.parse(JSON.stringify(this.treeData))
                    } else {
                        this.treeData = JSON.parse(JSON.stringify(this.treeDataBak))
                    }
                    setTimeout(() => {
                        if (this.treeData !== null && this.treeData.length !== 0) {
                            if (this.binding.value === 'staff' || this.binding.value === 'wfNodeUser') {
                                const nodeList = this.zTree.getNodesByParamFuzzy('title', searchkey)
                                for (let i = 0; i < nodeList.length; i++) {
                                    if (!nodeList[i].personId) {
                                        nodeList.splice(i--, 1)
                                    }
                                }
                                this.treeData = nodeList
                            } else {
                                const nodeList = this.zTree.getNodesByParamFuzzy('name', searchkey)
                                this.treeData = nodeList
                            }
                        }
                        this.searchDoading = false
                    }, 0)
                }, 0)
            }
            this.searchkey = searchkey
        },
        onSelectByTabsHandleClick(val) {
            // 机构全体人员，按机构、按岗位、按群组标签点击
            const _this = this
            _this.treeData = []
            _this.searchkey = ''

            const orgCodes = []
            _this.byOrgTreeData.forEach(item => {
                if (item.isRealOrg === 1 && item.orgLevel === 1) {
                    orgCodes.push(item.code)
                }
            })
            if (orgCodes.length === 0) {
                orgCodes.push(_this.loginUser.orgCode)
            }
            let treeData = null
            const reqParams = {
                method: 'POST',
                url: 'workflow/wfInstance/getWfNodeUsers',
                params: { orgCodes: orgCodes.join(), byType: val }
            }

            if (val === 'byWorkgroup') {
                treeData = this.byWgTreeData
            } else if (val === 'byJobPosition') {
                treeData = this.byJbTreeData
            } else {
                treeData = this.byOrgTreeData
            }

            if (treeData === null) {
                this.$http(reqParams).then(res => {
                    if (res.code === 'success') {
                        this.treeData = this.treeDataAdapter(res.body.listdata)
                    } else {
                        this.$alert(res.message, { type: 'error' })
                    }
                })
            } else {
                if (this.showSelectByTabs && this.selectedNodes.length > 0) {
                    let pSelected = ''
                    this.selectedNodes.forEach(item => {
                        if (pSelected !== '') pSelected += ','
                        pSelected += item.id
                    })
                    if (pSelected !== '') {
                        treeData.forEach(item => {
                            if (pSelected.indexOf(item.id) !== -1) {
                                for (let k = 0; k < this.selectedNodes.length; k++) {
                                    if (this.selectedNodes[k].id === item.id) this.selectedNodes.splice(k--, 1)
                                }
                                this.selectedNodes.push(item)

                                item.checked = true
                            }
                        })
                    }
                }

                _this.treeData = treeData
            }
        },
        submitForm() {
            const _this = this
            const model = this.vnode.data.model.expression.split('.')

            new Promise((resolve, reject) => {
                const prevSelected = this.getPrevSelected()

                if (this.selectedNodes.length === 0 && prevSelected.length > 0) {
                    this.$confirm('是否确认清除已选？', '确认操作', { type: 'warning' }).then(() => {
                        resolve(true)
                    }).catch(err => {
                        reject(err)
                    })
                } else {
                    resolve(true)
                }
            }).then(async() => {
                if (_this.vnode.context[_this.callback] !== undefined) {
                    await _this.vnode.context[_this.callback](_this.selectedNodes, _this.el.attrs)
                } else if (_this.vnode.context[_this.callback] !== undefined) {
                    await _this.vnode.context[_this.callback](_this.selectedNodes, _this.el.attrs)
                } else if (_this.vnode.context.$vnode.context[_this.callback] !== undefined) {
                    await _this.vnode.context.$vnode.context[_this.callback](_this.selectedNodes, _this.el.attrs)
                } else if (_this.vnode.context.$vnode.context.$vnode.context[_this.callback] !== undefined) {
                    await _this.vnode.context.$vnode.context.$vnode.context[_this.callback](_this.selectedNodes, _this.el.attrs)
                } else {
                    let selected = ''
                    this.selectedNodes.forEach(function(node) {
                        if (selected !== '') selected += '、'
                        selected += node.name
                    })

                    if (model[0] === 'formItem' && this.vnode.context['valueChange'] !== undefined) {
                        this.vnode.context['valueChange'](selected)
                    }
                    if (this.vnode.context[model[0]]) {
                        if (model.length === 2) {
                            this.vnode.context.$set(this.vnode.context[model[0]], model[1], selected)
                        } else {
                            this.vnode.context.$set(this.vnode.context, model[0], selected)
                        }
                    }
                }

                if (this.vnode.context[model[0]]) {
                    if (model.length === 2) {
                        this.vnode.data.model.value = this.vnode.context[model[0]][model[1]] || ''
                    } else if (model.length === 3) {
                        this.vnode.data.model.value = this.vnode.context[model[0]][model[1]][model[1]] || ''
                    } else {
                        this.vnode.data.model.value = this.vnode.context[model[0]] || ''
                    }

                    if (model[0] === 'formItem' && this.vnode.context['valueChange'] !== undefined) {
                        this.vnode.context['valueChange'](this.vnode.data.model.value)
                    }
                }

                this.vnode.context.$forceUpdate()
                this.closeDialog()
            })
        },
        closeDialog() {
            this.dialogFormVisible = false
            this.loading = false
            this.winWidth = 600
            this.el = null
            this.binding = null
            this.vnode = null
            this.dialogName = null
            this.treeData = null
            this.selectedNodes = []
            this.rootTreeData = null
            this.selectRootOrg = ''
            this.rootOrgList = []
            this.subOrgList = {}
            this.searchkey = ''
            if (window.fontMagnify !== undefined)window.fontMagnify = false
        }
    }
}
</script>

<style scoped lang="scss">
.search-input-container{
    /deep/ .el-input-group__prepend{
        width: 90px;
        background-color:#fff;
        color:#333;
        border-bottom-right-radius: 0px;
        border-top-right-radius: 0px;
    }
}

.ztree-container{
    height:320px;

    /deep/ .el-tabs--top{
        margin-top: 0px;

        .el-tabs__header{
            margin: 0px;
            border-bottom: solid 1px #dfe6ec;
        }

        .el-tabs__nav-wrap::after{
            height:0px;
        }
    }
}

/deep/ .listitem{
    .ztree * {font-size: 10pt;font-family:"Microsoft Yahei",Verdana,Simsun,"Segoe UI Web Light","Segoe UI Light","Segoe UI Web Regular","Segoe UI","Segoe UI Symbol","Helvetica Neue",Arial}
    .ztree li ul{ margin:0; padding:0}
    .ztree li {line-height:30px; }
    .ztree li:hover { background:#E7E7E7;}
    .ztree li a {height:30px;padding-top: 0px;}
    .ztree li a:hover {text-decoration:none; background-color: none;}
    .ztree li a.curSelectedNode {background:none;border:0;height:30px;}
    .ztree li span {line-height:30px;;z-index: 99999}

    .curSelectedLI { background: #D4D4D4;}

    .selected span{display: block;cursor: pointer;line-height:30px;height:30px;}
}
.selectnode{
    cursor: pointer;
    line-height: 20px;
    white-space: nowrap;
}
.treeNode{
    border:1px solid #dfe6ec;
    margin-right:5px;
    height: 100%;
    .select-all-org{
        line-height: 32px;
        padding:0 8px;
        border-bottom:1px solid #dfe6ec;
        /deep/ .el-checkbox__label{
            color: #333;
            font-size: 13px;
        }
        /deep/ .el-checkbox{
            font-size: 13px;
        }
    }
}
.searchdoing{
    /deep/ .el-loading-mask{background-color: rgba(255,255,255,1)}
}
.font-magnify{
    /deep/ .ztree{
        .node_name{ font-size: 15px; }
        li{line-height: 19px;}
    }
    .selectnode{
        font-size: 15px;
        line-height: 25px;
    }
}
</style>
